/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2019 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.factorypattern.simplefactory.factory;

import com.suxiaoxiao.springbootlearn.designpattern.factorypattern.simplefactory.pizza.Pizza;

import javax.validation.constraints.NotNull;

/**
 * Pizza factory
 *
 * @author zhaorongzhang
 * @version PizzaStore.java, v 0.1 2019/12/28 4:20 下午 zhaorongzhang Exp $$
 */
public abstract class AbstractPizzaStore {

    /**
     * 工厂模式创造对象方法
     * @param type
     * @return
     */
    public Pizza orderPizza(String type) {
        Pizza pizza;

        pizza = createPizza(type);

        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();

        return pizza;
    }

    /**
     * 制造 pizza
     * @param type
     * @return
     */
    protected abstract Pizza createPizza(@NotNull String type);

}